<?php


namespace app\common\model\tang;

use app\common\impl\Comm;
use app\common\model\CommonBaseModel;
use app\common\model\tang\Merchant;
use think\Facade\Db;

class NoticeApply extends CommonBaseModel implements Comm
{

    public function getAdminPageData($param = [], $order = 'id desc',$where=[])
    {
        $model = self::where($where);
        if (isset($param["title"]) && !empty($param['title'])){
            $where[] = ["title","=",$param["title"]];
        }
        $data = $model->with(['merchant','notice'])->order($order)->where($where)->page(PAGE)->limit(LIMIT)->select()->toArray();
        $count = $model->count("id");
        return parent::ajaxResult($data,$count);

    }
    public function merchant(){
        return $this->hasOne(Merchant::class,'id','userId')->field('id,name,company');
    }
    public function notice(){
        return $this->hasOne(Notice::class,'id','noticeId')->field('id,title');
    }
    public function delById($id)
    {
        // TODO: Implement delById() method.
    }

    public function doAll($data)
    {
        // TODO: Implement doAll() method.
        return parent::doAllData($data);
    }
}